<% unless compiler == "terraformvalidator-codegen" -%>
// waitForAttachmentToBeProvisioned waits for an attachment to leave the
// "UNPROVISIONED" state, to indicate that it's either ready or awaiting partner
// activity.
func waitForAttachmentToBeProvisioned(d *schema.ResourceData, config *Config, timeout time.Duration) error {
	return resource.Retry(timeout, func() *resource.RetryError {
		if err := resourceComputeInterconnectAttachmentRead(d, config); err != nil {
			return resource.NonRetryableError(err)
		}

		name := d.Get("name").(string)
		state := d.Get("state").(string)
		if state == "UNPROVISIONED" {
			return resource.RetryableError(fmt.Errorf("InterconnectAttachment %q has state %q.", name, state))
		}
		log.Printf("InterconnectAttachment %q has state %q.", name, state)
		return nil
	})
}
<% end -%>
